package top.lishuoboy.spring.bean_di;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

@Component
public class Student21FactoryBean implements FactoryBean {   // 注意：不是 BeanFactory
    @Override
    public Object getObject() throws Exception {
        return new Student21();
    }

    @Override
    public Class<?> getObjectType() {
        return Student21.class;
    }

    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();  // 调用父类默认的Scope 即，返回true，单例模式
    }
}